#! /usr/bin/python
# -*- coding: cp1250 -*-
#sys.path.append(r'C:\AFT\.pylib')

import glob, sys, os, re, string
import pepe.p_txt.bigtxt as bt

def cleanup_regex(s, r):
    res = str(s)
    for i in r:
        res = re.sub(i[0],i[1], res)
    return res

if __name__ == "__main__":

    '''czech/slovak names - strip
    s.r.o.|, spol. s r.o|a.s.|GmbH|Ltd ..... etc
    Ing|Mgr|Dr|RNDr|MuDr.
    '''
    regx = [
    [",{0,1} {0,1}(a|s)pol\. {0,1}s r\. {0,1}o\. {0,}\|","|"],
    ["[,.]{0,1} {0,}s {0,}\.{0,1}r\.o\.{0,2} {0,}\|", "|"],
    [",{0,1} {0,}spol\. {0,1}s r\.o\.{0,1} {0,}\|", "|"],
    [",{0,1} {0,}a. {0,}s\.{0,1} {0,}\|", "|"],
    [" Gm(b|B)(h|H) {0,}\|", "|"],
    [" Ltd {0,}\|", "|"],
    [" v\.o\.s\. {0,}\|", "|"],
    [",{0,1} Mgr\. {0,}\|", "|"],
    [",{0,1} M(U|u)(D|d)(R|r)\. {0,}\|", "|"],
    [",{0,1} Dr\. {0,}\|", "|"],
    [",{0,1} R(N|n)(D|d)(R|r)\.{0,}\|", "|"],
    [",{0,1} J(U|u)(D|d)(R|r)\.{0,}\|", "|"],
    [",{0,1} Ing\. {0,}\|", "|"],
    [",{0,1} k\.s\. {0,1}\|", "|"]
    ]

    print cleanup_regex("xxx, spol. s r.o.|", regx)
    
